import $ from 'jquery'
import * as joint from 'jointjs'
import Element from './element'

class Rect extends Element {
    constructor(...args) {
        super(...args)
        this._jointInstance = new joint.shapes.basic.Rect(this.jointAttrs)
    }

    getBasicAttrs() {
        var superAttrs = super.getBasicAttrs()
        var rectAttrs = {
            cursor: "auto",
            attrs: {
                rect: {
                    fill: {
                        type: 'linearGradient',
                        stops: [{
                                offset: '0%',
                            }, //渐变开始
                            {
                                offset: '100%',
                            }
                        ], //渐变结束
                        attrs: {
                            x1: '0%',
                            y1: '0%',
                            x2: '0%',
                            y2: '100%'
                        }
                    },
                    'stroke-width': 1 //边框大小
                },
            }
        }
        return $.extend(true, superAttrs, rectAttrs)
    }


}

export default Rect